package net.qhzw.vip.qiyu.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.qhzw.vip.qiyu.entity.DtsUserBill;
import net.qhzw.vip.qiyu.mapper.DtsUserBillMapper;
import net.qhzw.vip.qiyu.model.IncomeTodayDetails;
import net.qhzw.vip.qiyu.service.DtsUserBillService;
import net.qhzw.vip.qiyu.util.MyDateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DtsUserBillServiceImpl extends ServiceImpl<DtsUserBillMapper, DtsUserBill>
        implements DtsUserBillService {

    @Autowired
    private DtsUserBillMapper dtsUserBillMapper;

    /***
     * 查询今日系统扣费
     * @return
     */
    @Override
    public String queryTodaysIncome(Long shopId) {
        return dtsUserBillMapper.queryTodaysIncome(shopId);
    }

    /***
     * 查询今日收入明细
     * @return
     */
    @Override
    public List<IncomeTodayDetails> incomeTodayDetails(Long shopId) {
        String todayStart = MyDateUtils.getTodayStart();
        String todayEnd = MyDateUtils.getTodayEnd();
        return dtsUserBillMapper.incomeTodayDetails(todayStart, todayEnd, shopId);
    }

    @Override
    public void deleteByUserId(Long userId) {
        dtsUserBillMapper.deleteByUserId(userId);
    }
}
